Linear Scan Register Allocation for the Java HotSpot Client Compiler
نویسندگان
چکیده
Register allocation is the task of assigning local variables and temporary values to physical registers of a processor. It is crucial for the efficiency of compiled code. The most commonly used algorithm treats the task of register allocation as a graph coloring problem. It generates code of good quality, but is too slow for just-in-time compilers because of its quadratic runtime complexity. For such compilers, the linear scan algorithm is an efficient alternative: It generates code of nearly the same quality, but is much faster than the graph coloring algorithm because it needs only a single pass over the lifetime intervals. The Java HotSpot Virtual Machine by Sun Microsystems uses a just-in-time compiler to generate native code for frequently executed methods. To achieve a high compilation speed and a low startup time, the HotSpot client compiler avoids time-consuming optimizations. The current product version assigns registers using a local heuristic. In the context of this master thesis, a research version of the compiler was extended with the linear scan algorithm for register allocation. The implemented variant improves the basic algorithm with more advanced optimizations: It makes use of lifetime holes, splits intervals if necessary and models register constraints of the target architecture with fixed intervals. Benchmark results prove that the linear scan algorithm is a good tradeoff if both compilation time and runtime of a program matter: The compilation time is only slightly higher in comparison with the old local heuristic for register allocation, but the resulting code executes about 30% faster. The benchmarks also indicate the high impact of the Intel SSE2 extensions on the speed of numeric Java applications.
منابع مشابه
Incorporating Better Register Allocation into Jikes
In dynamically compiled code, it is important not only that the compiler produce fast code, but also that the compiler itself costs little overhead to the runtime application. These two competing goals motivate the importance of accurate cost-benefit analysis for any optimizations performed in a dynamic compilation system. The Jikes RVM, which performs Just-In-Time (JIT) compilation of Java byt...
متن کاملHybrid Optimizations: Which Optimization Algorithm to Use?
We introduce a new class of compiler heuristics: hybrid optimizations. Hybrid optimizations choose dynamically at compile time which optimization algorithm to apply from a set of different algorithms that implement the same optimization. They use a heuristic to predict the most appropriate algorithm for each piece of code being optimized. Specifically, we construct a hybrid register allocator t...
متن کاملSSA-Form-Based Register Allocation for the Java HotSpotTM Server Compiler
Register allocation, i.e., the task of assigning processor registers to local variables and temporary values, is one of the most important compiler optimizations. A vast amount of research has led to algorithms ranging from simple and fast heuristics to optimal algorithms with exponential time complexity. Because the problem is known to be NP-complete [2], algorithms must balance the time neces...
متن کاملNew tricks of the GraalVM
This report gives a high level overview of the Graal JIT compiler developed in Oracle Labs in collaboration with the Institute for System Software at the Johannes Kepler University. Graal is written in Java and aims at replacing or complementing the HotSpot server and client compilers. I’ll introduce the main concepts of how Graal works and bring out the biggest differences to the current HotSp...
متن کاملCooperative Instruction Scheduling with Linear Scan Register Allocation
Linear scan register allocation is an attractive register allocation algorithm because of its simplicity and fast running time. However, it is generally felt that linear scan register allocation yields poorer code than allocation schemes based on graph coloring. In this paper, we propose a pre-pass instruction scheduling algorithm that improves on the code quality of linear scan allocators. Our...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2004